#!/usr/bin/env python3
"""
智能体问答系统主启动文件
"""
import os
import logging
from dotenv import load_dotenv
from backend.api.app import create_app_with_socketio

# 加载环境变量
load_dotenv()

# 配置日志
logging.basicConfig(
    level=getattr(logging, os.getenv('LOG_LEVEL', 'INFO')),
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)

if __name__ == '__main__':
    app, socketio = create_app_with_socketio()
    socketio.run(
        app,
        host='0.0.0.0',
        port=5000,
        debug=os.getenv('FLASK_ENV') == 'development'
    )